import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluttertoast/fluttertoast.dart';

/// 显示 toast
Future<bool?> showToast({
  required String msg,
  Toast? toastLength,
  Color backgroundColor = const Color.fromARGB(160, 0, 0, 0),
  Color textColor = Colors.white,
}) async {
  await Fluttertoast.cancel();
  return await Fluttertoast.showToast(
    msg: msg,
    toastLength: Toast.LENGTH_SHORT,
    gravity: ToastGravity.CENTER,
    timeInSecForIosWeb: 1,
    backgroundColor: backgroundColor,
    textColor: textColor,
    fontSize: 16.sp,
  );
}
